#version 430 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTexCoords;
layout (location = 3) in mat4 instanceMatrix;


uniform mat4 view;
uniform mat4 projection;
uniform float pointScale;
uniform float pointSize;


void main(){
	vec3 eyeSpacePos = (view * instanceMatrix * vec4(aPos, 1.0f)).xyz;
	gl_PointSize = -pointScale * pointSize / eyeSpacePos.z;
	// to prevent single or a few particles.
	//	if(aPos < densityLowerBound) 
	//		gl_PointSize = 0.0f;
	gl_Position = projection * view * instanceMatrix * vec4(aPos, 1.0f);
}